#pragma once
#include "btBulletDynamicsCommon.h"
#include <memory>
#include <vector>

class PhysEngine
{
public:
	PhysEngine();
	btDiscreteDynamicsWorld* getWorld();
	void step(float dt);
	btRigidBody* createBody(btCollisionShape* shape, const btTransform& transform, float mass);
	void removeBody(btRigidBody* body);
	void addJoint(btTypedConstraint* joint, bool disableCollision);
	void reset();
	~PhysEngine();
private:
	std::auto_ptr<btDefaultCollisionConfiguration> collisionConfiguration;
	std::auto_ptr<btCollisionDispatcher> dispatcher;
	std::auto_ptr<btBroadphaseInterface> broadphase;
	std::auto_ptr<btSequentialImpulseConstraintSolver> solver;
	std::auto_ptr<btDiscreteDynamicsWorld> world;
	std::vector<btCollisionShape*> collisionShapes;
};
